#include <stdio.h>
#include <opencv2/opencv.hpp>
#include "opencv_helper.hpp"

static
void draw_line(cv::Mat& image, cv::Point& p1, cv::Point& p2)
{
    cv::Scalar black = och::get_rgb_color_from_hex(0x000000);
    cv::line(image, p1, p2, black);
}

/// @brief 绘制五角星
static
void draw_five_pointed_star(cv::Mat& image)
{
    cv::Size size = image.size();

    std::vector<cv::Point> pts = och::get_regular_polygon_vertices(size, 5);
    cv::Point pA = pts[0];
    cv::Point pB = pts[1];
    cv::Point pC = pts[2];
    cv::Point pD = pts[3];
    cv::Point pE = pts[4];

    draw_line(image, pE, pC);
    draw_line(image, pC, pA);
    draw_line(image, pA, pD);
    draw_line(image, pD, pB);
    draw_line(image, pB, pE);
}

int main()
{
    printf("Hello, World!\n");

    cv::Size size;
    size.width = 500;
    size.height = 500;
    cv::Mat image(size, CV_8UC3);
    image = cv::Scalar(255, 255, 255, 255);
    
    draw_five_pointed_star(image);

    cv::imshow("image", image);
    cv::waitKey(0);

    return 0;
}

